﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace SuiYuan.UI.Controls.Notify
{
    /// <summary>
    /// LayUIMessageBox.xaml 的交互逻辑
    /// </summary>
    public partial class LayUIMessageBox : Window
    {
        public LayUIMessageBox()
        {
            InitializeComponent();
        }

        private void LayUIButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
            this.Close();
        }
        private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)
        {
            this.DialogResult = true;
            this.Close();
        }

        public static bool? Show(string title, string content, int icon = 0)
        {
            LayUIMessageBox messageBox = new LayUIMessageBox();
            messageBox.Title.Text = title;
            messageBox.Text1.Text = content;
            messageBox.Text2.Text = content;
            if (icon == 0)
            {
                messageBox.Text1.Visibility = Visibility.Visible;
                messageBox.Text2.Visibility = Visibility.Hidden;
                messageBox.Icon.Visibility = Visibility.Hidden;
            }
            else
            {
                messageBox.Text1.Visibility = Visibility.Hidden;
                messageBox.Text2.Visibility = Visibility.Visible;
                messageBox.Icon.Visibility = Visibility.Visible;
                switch (icon)
                {
                    case 1:
                        messageBox.Icon.Text = "\ue658";
                        messageBox.Icon.Foreground = new SolidColorBrush(Color.FromRgb(0xf3, 0x9b, 0x13));
                        break;
                    case 2:
                        messageBox.Icon.Text = "\ue607";
                        messageBox.Icon.Foreground = new SolidColorBrush(Color.FromRgb(0x19, 0xc1, 0xa5));
                        break;
                    case 3:
                        messageBox.Icon.Text = "\ue608";
                        messageBox.Icon.Foreground = new SolidColorBrush(Color.FromRgb(0xeb, 0x6a, 0x5c));
                        break;
                    case 4:
                        messageBox.Icon.Text = "\ue61e";
                        messageBox.Icon.Foreground = new SolidColorBrush(Color.FromRgb(0xf4, 0xc5, 0x02));
                        break;
                    case 5:
                        messageBox.Icon.Text = "\ue60c";
                        messageBox.Icon.Foreground = new SolidColorBrush(Color.FromRgb(0xab, 0xab, 0xab));
                        break;
                    case 6:
                        messageBox.Icon.Text = "\ue656";
                        messageBox.Icon.Foreground = new SolidColorBrush(Color.FromRgb(0xe8, 0x59, 0x4a));
                        break;
                    case 7:
                        messageBox.Icon.Text = "\ue627";
                        messageBox.Icon.Foreground = new SolidColorBrush(Color.FromRgb(0x36, 0xd4, 0x84));
                        break;
                    default:
                        messageBox.Icon.Text = "\ue658";
                        messageBox.Icon.Foreground = new SolidColorBrush(Color.FromRgb(0xf3, 0x9b, 0x13));
                        break;
                }
            }
            return messageBox.ShowDialog();
        }

        private void main_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }
    }
}
